package him.action.coursemanage.course;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import him.action.Action;
import him.action.ActionForward;
import him.dto.coursemanage.CourseDTO;
import him.dto.coursemanage.SubjectDTO;
import him.service.CourseService;
import him.service.SubjectService;
import him.serviceimple.CourseServiceImple;
import him.serviceimple.SubjectServiceImple;

public class CourseUpdateBfAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		ActionForward actforward = new ActionForward();
		CourseService courseService = CourseServiceImple.getInstance();
		SubjectService subjectService = SubjectServiceImple.getInstance();
		CourseDTO dto = new CourseDTO();
		
		String course_code = request.getParameter("course_code");
		dto.setCourse_code(course_code);
		
		dto = courseService.getCourseDetail(dto);
		List<SubjectDTO> list = subjectService.getAllSubjectName();
		
		request.setAttribute("dto", dto);
		request.setAttribute("list", list);
		actforward.setUrl("courseupdatebf");
		
		return actforward;
	}

}
